<template>
  <!-- 头部部分 -->
  <header class="header">
    <h1>todos</h1>
    <input
      @keyup.enter="addTodoH"
      class="new-todo"
      placeholder="请输入任务名称"
    />
  </header>
</template>

<script>
export default {
  name: "HeaderT",
  components: {},
  props: {},
  data() {
    return {};
  },
  computed: {},
  watch: {},
  created() {},
  methods: {
    addTodoH(e) {
      const obj = {
        id: 6,
        todo: e.target.value,
        done: false,
      };
      // this.addTodo(obj);
      this.$emit("addTodo", obj);
      e.target.value = "";
    },
  },
};
</script>

<style scoped></style>
